<td width="727"><table width="727" border="0" cellspacing="0" cellpadding="0" >
                                <tr> 
                                  <td width="727" height="47" valign="top" background="img/bar_blue.jpg">
								  <table width="727" border="0" cellspacing="0" cellpadding="0" >
                                      <tr> 
                                        <td width="10" height="47">&nbsp;</td>
                                        <td width="23" height="47"><img src="img/bar_flblue.jpg" width="23" height="23"></td>
                                        <td width="10" height="47">&nbsp;</td>
                                        <td height="47" class="tahoma12W"><strong> 
                                          <?php echo $lang['CONTENT_TITLE_CART']; ?></strong></td>
                                      </tr>
                                    </table></td>
                                </tr>
                                <tr> 
                                  <td width="727" height="6" valign="top"><img src="img/spec_blank.gif" width="10" height="7"></td>
                                </tr>
                                <tr> 
                                  <td width="727" height="878" valign="top" >
								  <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border: 1px solid #CCCCCC;">
                                      <tr> 
                                        <td height="601" valign="top" ><table width="100%" height="878" border="0" cellpadding="0" cellspacing="0">
                                            <tr> 
                                              <td height="763" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                  <tr> 
                                                    <td width="10" height="10"></td>
                                                    <td height="10"></td>
                                                    <td width="10" height="10"></td>
                                                  </tr>
                                                  <tr> 
                                                    <td width="10">&nbsp;</td>
                                                    <td align="left" valign="top" class="arial12G66">
														
														<script>	
																function isDigit(c) {
																 // alert(c.value);
																  var intRegex = /^\d+$/;
																  if(!intRegex.test(c.value)){
																	c.value = '';
																  }
																}
															$(document).ready(function()
															{
																$("#imgSelectAll").click(function()
																{	$(".checkbox").each( function() {
																		$(this).attr("checked",true);
																	})
																	
																});
																$("#imgUnSelectAll").click(function()
																{	$(".checkbox").each( function() {
																		$(this).attr("checked",false);
																	})
																	
																});
																
															}); 
															
															function toggleChecked() {
															$(".checkbox").each( function() {
															$(this).attr("checked",true);
															})
															}
														</script>
														<form action="cart.php?action=update" method="post" id="cartForm">
														<?php
														$cart = $_SESSION['cart'];
														if($cart){
														
														?>
														<table width="100%" border="0" cellspacing="0" cellpadding="0">
															<tr> 
																<td width="300" valign="top" class="arial12G66">
																	<table width="100%" border="0" cellspacing="0" cellpadding="0">
																		<tr>
																			<td valign="top" class="arial12G66" style="width:75px;">
																				<table width="90" border="0" cellspacing="0" cellpadding="0">
																					<tr>	
																						<td valign="top" class="arial12G66"><div onclick="toggleChecked()"><?php echo $lang['FORM_TRANS_SELECT_ALL'];  ?></div></td>
																						<td><img id="imgSelectAll"  src="img/btn_selectAll.jpg" width="16" height="16" border="0"></td>
																					</tr>
																				</table>
																			</td>
																			<td valign="top" class="arial12G66" style="width:85px;">
																				<table width="100" border="0" cellspacing="0" cellpadding="0">
																					<tr>	
																						<td valign="top" class="arial12G66"><?php echo $lang['FORM_TRANS_UNSELECT_ALL'];  ?></td>
																						<td><img id="imgUnSelectAll" src="img/btn_unselectAll.jpg" width="16" height="16" border="0"></td>
																					</tr>
																				</table>
																			</td>
																			<td valign="top" class="arial12G66" style="width:60px;">
																				
																			
																				<table width="60" border="0" cellspacing="0" cellpadding="0">
																					<tr>	
																						<td valign="top" class="arial12G66"><?php echo $lang['FORM_TRANS_DELETE'];  ?></td>
																						<td>
																						<button name="submit" type="submit" style="border: 0; background: transparent;float:right; 
																							cursor:pointer;">
																						   <img src="img/btn_delete.jpg" width="16" height="16" border="0">
																						</button>
																						</td>
																					</tr>
																				</table>
																				
																				
																			</td>
																		</tr>
																	</table>
																</td>
			                                                    <td valign="top" align="right">
																	<div id="waiting" style="display: none;" class="arial12G66">
														                <?php echo $lang['FORM_LOADING']; ?><br />
														                <img src="images/loading.gif" height="16" width="16" title="Loader" alt="Loader" />
														            </div>
																	
																	<div style="display:block;" class="arial12G66" >
																		<?php echo $lang['FORM_TRANS_LOCATION_PRICE']; ?> : 
																		<select id="location" style="width:200px;" class="arial12G66">
																			<option value="0" <?php if($_SESSION['locationPrice'] == 0) echo 'selected'?>>Peninsular Malaysia</option>
																			<option value="1" <?php if($_SESSION['locationPrice'] == 1) echo 'selected'?>>Sabah & sarawak</option>
																		</select>
																	
																	<script>	
																		$(document).ready(function(){
																			$('#location').change(function() {
																				//alert('ID : '+$('#location :selected').val());
																				$('#waiting').show(500);
																				$('#cartDiv').hide(0);
																				$.ajax({
																					type : 'POST',
																					url : 'getLocationPrice.php',
																					dataType : 'json',
																					data: {
																						location : $('#location :selected').val()
																					},
																					success : function(data){
																						//alert('success');
																						$('#waiting').hide(500);
																						if (data.error === true)
																							$('#cartDiv').show(500);
																						//alert(data.value);
																						//$('#cartDiv').fadeOut('slow').load('cart.php').fadeIn("slow");
																						 //$("#cart").replaceWith($('#cart', $(html)));
																						  location.reload();
																						  //$("#cartDiv").load("cart.php");

																					}
																				});
																				
																				return false;
																				
																			});
																			
																		});
																		
																		
																	</script>
																	</div>
																</td>
			                                                </tr>
															<tr height="10">	
																<td colspan="2"></td>
															</tr>
														</table>
													  <?php  
														} //close if session is null
													  ?>
													  <?php 
													  //echo showCart($lang); 
													  
													    $cart = $_SESSION['cart'];
														$location = $_SESSION['locationPrice'] ;
														
														//set default
														$priceLocation = 'price_wm';

														if($location == null){
															if($_SESSION['isAhli'] == 'yes' ){ 
																$priceLocation = 'price_wm_ahli';
															}else{ 
																$priceLocation = 'price_wm';
															}
														}else{
															if($location == 1){
																if($_SESSION['isAhli'] == 'yes' ){ 
																	$priceLocation = 'price_em_ahli';
																}else{ 
																	$priceLocation = 'price_em';
																}
															}else{
																if($_SESSION['isAhli'] == 'yes' ){ 
																	$priceLocation = 'price_wm_ahli';
																}else{ 
																	$priceLocation = 'price_wm';
																}
															}
														}
														if ($cart) {
															$items = explode(',',$cart);
															$contents = array();
															foreach ($items as $item) {
																$contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1;
															}
															echo '<div id="cartDiv" >';
															echo '<table width="100%"  cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #CCCCCC;">
																	<tr bgcolor="#F1F3EB" height="25">
																				<td width="40px" align="center" class="arial11P" style="border: 1px solid #CCCCCC;">'.$lang['FORM_TRANS_DELETE'].'
																				</td>
																				<td align="center" class="arial11P" style="border: 1px solid #CCCCCC;">'.$lang['FORM_TRANS_PRODUCT'].'
																				</td>
																				<td width="70px" align="center" class="arial11P" style="border: 1px solid #CCCCCC;">'.$lang['FORM_TRANS_QTY'].'
																				</td>
																				<td width="80px" align="center" class="arial11P" style="border: 1px solid #CCCCCC;">'.$lang['FORM_TRANS_TOTAL_ITEMS'].'
																				</td>
																				<td width="80px" align="center" class="arial11P" style="border: 1px solid #CCCCCC;">'.$lang['FORM_TRANS_TOTAL_WEIGHT'].'
																				</td>
																    </tr>';
															foreach ($contents as $id=>$qty) {
																$sql = 'SELECT * FROM item WHERE id = '.$id;
																$rCheck= $db->sql_total($sql);
																$rItem= $db->sql_list($sql);
																if($rCheck <> 0){
																	echo '	
																		<tr>
																			<td width="40px" align="center" style="border: 1px solid #CCCCCC;">
																				<input class="checkbox" type="checkbox" name="del[]" value="'.$id.'">
																			</td>
																			<td  align="left" style="border: 1px solid #CCCCCC;">
																				<table width="100%" border="0" cellspacing="0" cellpadding="0">
																					<tr> 
																						<td align="left" class="arial11P"> 
																							<div style="margin:4px; border:1px solid #CCCCCC;"> 
																								<img src="'.IMAGEITEM.$rItem['image'].'"  width="87" height="68"  >
																							</div>
																						</td>
																						<td width="10">&nbsp;</td>
																						<td valign="top" width="100%">
																							<table width="100%" border="0" cellspacing="0" cellpadding="0">
																								<tr> 
																									<td height=2></td>
																								</tr>
																								<tr> 
																									<td class="arial11P"><strong><a href="product_detail.php?id='.$rItem[id].'" >'.$rItem['name'].'</a></strong></td>
																								</tr>
																								<tr> 
																									<td height="3" valign="top"><img src="img/spec_blank.gif" width="10" height="3"></td>
																								</tr>
																								<tr> 
																									<td class="arial10G660">KOD 
																										'.$rItem['kod'].'</td>
																								</tr>
																								<tr> 
																									<td height="3" valign="top"><img src="img/spec_blank.gif" width="10" height="3"></td>
																								</tr>
																								<tr> 
																									<td class="arial11P"><strong>'.$lang['FORM_PRICE'].'  
																										RM'.sprintf("%01.2f", $rItem[$priceLocation]).'/Unit</strong>
																									</td>
																								</tr>
																								<tr> 
																									<td height="3" valign="top"><img src="img/spec_blank.gif" width="10" height="3"></td>
																								</tr>
																								<tr> 
																									<td class="arial11P"><strong>'.$lang['FORM_WEIGHT'].'
																										'.$rItem['weight'].'KG/Unit</strong>
																									</td>
																								</tr>
																							</table>
																						</td>
																					</tr>
																				</table>
																			</td>
																			<td  align="center" style="border: 1px solid #CCCCCC;">
																				<input style=" width: 30px;" type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" onkeypress="isDigit(this);" onchange="isDigit(this);" />
																			</td>
																			<td  align="center" style="border: 1px solid #CCCCCC;" class="arial11P">RM'.sprintf("%01.2f", ($rItem[$priceLocation] * $qty)).'
																			</td>
																			<td  align="center" style="border: 1px solid #CCCCCC;" class="arial11P">'.($rItem['weight'] * $qty).'KG
																			</td>
																		</tr>';
																	$totalitems += $rItem[$priceLocation] * $qty;
																	$totalweight += $rItem['weight'] * $qty;
																}
															}
															echo '		<tr bgcolor="#FFF380" height="25">
																			<td colspan="3"  align="right" style="border: 1px solid #CCCCCC;" class="arial11P">'.$lang['FORM_TRANS_TOTAL_ALLITEMS'].' &nbsp;&nbsp;
																			</td>
																			<td  width="70px" align="center" style="border: 1px solid #CCCCCC;" class="arial11P">RM'.sprintf("%01.2f", $totalitems).'
																			
																			</td>
																			<td  width="70px" align="center" style="border: 1px solid #CCCCCC;" class="arial11P">'.$totalweight.'KG
																			
																			</td>
																		</tr>
																		<tr bgcolor="#F1F3EB" height="25">
																			<td colspan="5"  align="right" style="border: 1px solid #CCCCCC;" class="arial11P">
																				<div style="float:right"><button type="submit" class="arial11P" style="float:right">'.$lang['FORM_TRANS_UPDATE_QTY'].'</button></div>
																			</td>
																		</tr>';
																		if($totalweight > MAX_KG) {
																		echo '<tr bgcolor="#FF6A6A" height="25">
																				<td colspan="5"  align="right" style="border: 1px solid #CCCCCC; padding:10px;" class="arial11P">
																				<div style="float:right"><strong style="color:darkred;">'.$lang['ERROR_CART_WEIGHT'].'</strong></div>
																			    </td>
																			  </tr>';
																		}
															echo '		</table>';
															echo ' </div>';
														} else {
															echo '<p>'.$lang['ERROR_CART_EMPTY'].'</p><input type="hidden" value="0" id="totalCart">';
														}
													  
													  
													  
													  ?>
													  </form>
													  <?php
													  
													    $isSemakCheckout = false; //later see at addtransaction.php
														//if(!$isSemakCheckout)
															//$_SESSION['cartConfirmCheckout'] = null;
														
														//print_r($_SESSION['cartConfirmCheckout']);
														
													  ?>
													  
													  <script>
													  $(function() {
		
															var selectpayment = $("#selectpayment"),
																allFields = $([]).add(selectpayment),
																tips = $("#validateTips");

															function updateTips(t) {
																tips.text(t).effect("highlight",{},1500);
															}

															function checkLength(o,n,min,max) {

																if ( o.val().length > max || o.val().length < min ) {
																	o.addClass('ui-state-error');
																	updateTips("Length of " + n + " must be between "+min+" and "+max+".");
																	return false;
																} else {
																	return true;
																}

															}

															function checkRegexp(o,regexp,n) {

																if ( !( regexp.test( o.val() ) ) ) {
																	o.addClass('ui-state-error');
																	updateTips(n);
																	return false;
																} else {
																	return true;
																}

															}
															
															$("#dialog").dialog({
																bgiframe: true,
																autoOpen: false,
																height: 180,
																modal: true,
																buttons: {
																	'Buat Pembayaran': function() {
																		var selectpayment = $('#selectpayment :selected').val();
																		$('#cpayment').val(selectpayment);
																		$("#checkoutcfmpay").click();
																		
																	},
																	Cancel: function() {
																		$(this).dialog('close');
																	}
																},
																close: function() {
																	allFields.val('').removeClass('ui-state-error');
																}
															});
															
															
															
															$('#checkoutcfm').click(function() {
																if($('#checkboxTerm').is(':checked')){
																	$('#dialog').dialog('open');
																}else{
																	alert('Sila klik checkbox untuk persetujuan terma dan syarat-syarat');
																}
																return false;
															})

														});
													  $(document).ready(function()
														{
															
																var billaddress = $('#billaddress').is(':checked');
																var shipaddress = $('#shipaddress').is(':checked');
																
																if(billaddress == false && shipaddress==false){
																	$('#tblBillAddress').hide();
																	$('#tblShipAddress').hide();
																}
																if(billaddress == true){
																	$('#tblBillAddress').show();
																	$('#tblShipAddress').hide();
																}
																if(shipaddress == true){
																	$('#tblBillAddress').hide();
																	$('#tblShipAddress').show();
																}
																$('#billaddress').click(function()
																{
																	$('#shipaddress').attr({checked: false});
																	$('#tblShipAddress').hide();
																	$('#tblBillAddress').show();
																});
																$('#shipaddress').click(function()
																{
																	$('#billaddress').attr({checked: false});
																	$('#tblBillAddress').hide();
																	$('#tblShipAddress').show();
																});
																
																$('#checkoutcfmX').click(function()
																{	
																	
																	$('#waitingCheckOut').show(500);
																	$.ajax({
																			type : 'POST',
																			url : 'addtransactioncfm.php',
																			dataType : 'json',
																			data: {
																				cOut : $('#cOut').val()
																			},
																			success : function(data){
																				$('#waitingCheckOut').hide(500);
																				if (data.success === false){
																					alert('Kesilapan Teknikal');
																					return false;
																				}
																				if (data.success === true){
																						
																						//window.location = 'https://www.onlinepayment.com.my/NBepay/pay/'+data.merchantID+'/fpx.php?amount='+data.amount+'&orderid='+data.orderId+'&bill_name='+data.name+'&bill_email='+data.email+'&bill_mobile='+data.notel+'&bill_desc='+data.desc+'&returnurl='+data.returnurl+'&vcode='+data.vcode;
																						//window.open("https://www.onlinepayment.com.my/NBepay/pay/"+data.merchantID+"/fpx.php?amount="+data.amount+"&orderid="+data.orderId+"&bill_name="+data.name+"&bill_email="+data.email+"&bill_mobile="+data.notel+"&bill_desc="+data.desc+"&vcode="+data.vcode,"","scrollbars=yes,width=800,height=1000,status=yes,toolbar=no,menubar=no")
																				}
																			}
																		
																	});
																	
																	return false;
																	
																}); 
																
														});
													  </script>
													<?php
													//if(isset($_POST['checkoutcfm'])){
													//	include_once('addtransactioncfm.php');
													//}
													if(isset($_POST['checkoutcfmpay'])){
														echo $_SESSION['selectpayment'] = $_POST['cpayment'];
													
														include_once('addtransactioncfm.php');
													}
													
													if(isset($_POST['checkout'])){
														
														$userx = "SELECT * from user where username = '$_SESSION[username]'";
														$resUserx = $db->sql_list($userx);
														$mailing_address_id = $resUserx['mailing_address_id'];
														$shipping_address_id = $resUserx['shipping_address_id'];
														$status = $resUserx['status'];
															
														if($_SESSION['islogin'] != 'yes'){
															$errors[] = $lang['ERROR_CHECKOUT_NOTLOGIN'];
														}
														if($_SESSION['islogin'] == 'yes'){
														
															
															$validProfile = true;
															if($status != 'verified'){
																$validProfile = false;
																$errors[] = $lang['ERROR_CHECKOUT_EMAILVALIDATE'];
															}
															if($validProfile){
																if(empty($_POST['shipper'])){
																	$errors[] = $lang['ERROR_SHIPPER'];
																}	
																if(empty($_POST['billaddress']) && empty($_POST['shipaddress'])){
																	$errors[] = $lang['ERROR_CHOOSE_ADDRESS'];
																}	
																if($_POST['billaddress'] == 'billaddress'){
																	if(empty($_POST['mail_name'])){
																		$errors[] = $lang['ERROR_NAME'];
																	}
																	if(empty($_POST['mail_phone'])){
																		$errors[] = $lang['ERROR_PHONE'];
																	}
																	if(empty($_POST['mail_address'])){
																		$errors[] = $lang['ERROR_ADDRESS'];
																	}
																	if(empty($_POST['mail_poskod'])){
																		$errors[] = $lang['ERROR_POSKOD'];
																	}
																	if(empty($_POST['mail_city'])){
																		$errors[] = $lang['ERROR_CITY'];
																	}
																	if(empty($_POST['mail_state'])){
																		$errors[] = $lang['ERROR_STATE'];
																	}
																	if(empty($_POST['mail_country'])){
																		$errors[] = $lang['ERROR_COUNTRY'];
																	}
																}
																if($_POST['shipaddress'] == 'shipaddress'){
																	if(empty($_POST['ship_name'])){
																		$errors[] = $lang['ERROR_NAME'];
																	}
																	if(empty($_POST['ship_phone'])){
																		$errors[] = $lang['ERROR_PHONE'];
																	}
																	if(empty($_POST['ship_address'])){
																		$errors[] = $lang['ERROR_ADDRESS'];
																	}
																	if(empty($_POST['ship_poskod'])){
																		$errors[] = $lang['ERROR_POSKOD'];
																	}
																	if(empty($_POST['ship_city'])){
																		$errors[] = $lang['ERROR_CITY'];
																	}
																	if(empty($_POST['ship_state'])){
																		$errors[] = $lang['ERROR_STATE'];
																	}
																	if(empty($_POST['ship_country'])){
																		$errors[] = $lang['ERROR_COUNTRY'];
																	}
																}
															}
														}
														if(is_array($errors)){
															echo '
															<table width=500 align=center border=0 cellspacing=0 cellpadding=0>
															<tr>
																<td>
															<div style="margin-bottom:10px;font-family: tahoma; font-size: 11px;">';
															echo '<p style="padding:0px; margin:0px; color:red;"><b>'.$lang[CONTENT_ERROR_OCCUR].'</b></p>';
															while (list($key,$value) = each($errors))
															{
																echo '<span style="padding:10px;color:red;">'.$value.'</span><br />';
															}
															echo '</div> </td></tr></table>';
														}else{
															$shipper_id = intval(mysql_real_escape_string($_POST['shipper']));  //will use at addtransaction.php
															$chooseAddress = "";
															if(($_POST['billaddress']) == 'billaddress'){
																$chooseAddress = mysql_real_escape_string($_POST['billaddress']); 
															}
															if(($_POST['shipaddress']) == 'shipaddress'){
																$chooseAddress = mysql_real_escape_string($_POST['shipaddress']); 
															}
															$mail_name = mysql_real_escape_string($_POST['mail_name']); 
															$mail_phone= mysql_real_escape_string($_POST['mail_phone']); 
															$mail_address = mysql_real_escape_string($_POST['mail_address']); 
															$mail_poskod = mysql_real_escape_string($_POST['mail_poskod']); 
															$mail_city= mysql_real_escape_string($_POST['mail_city']); 
															$mail_state = mysql_real_escape_string($_POST['mail_state']); 
															$mail_country = mysql_real_escape_string($_POST['mail_country']); 
															$ship_name = mysql_real_escape_string($_POST['ship_name']); 
															$ship_phone= mysql_real_escape_string($_POST['ship_phone']); 
															$ship_address = mysql_real_escape_string($_POST['ship_address']); 
															$ship_poskod = mysql_real_escape_string($_POST['ship_poskod']); 
															$ship_city= mysql_real_escape_string($_POST['ship_city']); 
															$ship_state = mysql_real_escape_string($_POST['ship_state']); 
															$ship_country = mysql_real_escape_string($_POST['ship_country']); 
															
															
															if($mailing_address_id != "" && $mailing_address_id > 0){
																$updateMailAddress= "UPDATE address SET nama='$mail_name', notel='$mail_phone', address ='$mail_address', poskod='$mail_poskod', city='$mail_city', 
																			state_id='$mail_state', country_id='$mail_country', modified_date=NOW() where id='$mailing_address_id'";
																$resultMailAddress = $db->sql_query($updateMailAddress);
															}else{
																$createMailAddress= "INSERT INTO address(nama,notel,address, poskod, city, state_id, country_id,created_date) VALUES 
																('$mail_name','$mail_phone','$mail_address','$mail_poskod', '$mail_city','$mail_state', '$mail_country', NOW())";
																$resultMailAddress = $db->sql_query($createMailAddress);
																$mailing_address_id = mysql_insert_id();
															}
															
															if($shipping_address_id != "" && $shipping_address_id > 0){
																$updateShipAddress= "UPDATE address SET nama='$ship_name', notel='$ship_phone',address ='$ship_address', poskod='$ship_poskod', city='$ship_city', 
																			state_id='$ship_state', country_id='$ship_country', modified_date=NOW() where id='$shipping_address_id'";
																$resultShipAddress = $db->sql_query($updateShipAddress);
															}else{
																$createShipAddress= "INSERT INTO address(nama,notel,address, poskod, city, state_id, country_id,created_date) VALUES 
																('$ship_name','$ship_phone','$ship_address','$ship_poskod', '$ship_city','$ship_state', '$ship_country', NOW())";
																$resultShipAddress = $db->sql_query($createShipAddress);
																$shipping_address_id = mysql_insert_id();
															}
															if($resultMailAddress && $resultShipAddress ){
																$updateUser= "UPDATE user SET name ='$mail_name', notel='$mail_phone', mailing_address_id='$mailing_address_id', 
																			shipping_address_id='$shipping_address_id', modified_date=NOW() where username='$_SESSION[username]'";
																$result = $db->sql_query($updateUser);

																include_once('addtransaction.php');
															}
														}
													}
													$QUser = "SELECT * from user where username = '$_SESSION[username]'";
																	$QUcheck= $db->sql_total($QUser);
																	$QUresult = $db->sql_list($QUser);
																
													$mailing_address_id = $QUresult['mailing_address_id'];
													$shipping_address_id = $QUresult['shipping_address_id'];
													
													
													?>
													<form action="" method="post" >
														<?php
															$displayNone ="display:none;";
															if($cart && $_SESSION['islogin']== "yes" && $totalweight <= 30){
																$displayNone = "";
															}
														?>
														<fieldset style="<?php echo  $displayNone; ?>">
															
															<legend class="tahoma11G" style="font-weight:bold; font-size:14px;"><?php echo $lang['CONTENT_TRANS_POSTAGE_INFO']; ?></legend> 
															<table width="700" align="center" border="0" cellspacing="0" cellpadding="0">
																<tr>
																	<td width="30%" class="tahoma11G"><?php echo $lang['FORM_SHIPPER']; ?></td>
																	<td width="5%"> : </td>
																	<td class="tahoma11G">
																		<select name="shipper" id="shipper" size="1" style="width:276px;" <?php if($isSemakCheckout) echo "disabled"; ?> >
																			 <option value='0' <?php if(isset($_POST['shipper']) && $_POST['shipper']==0){echo "selected"; }  ?> ><?php echo $lang['FORM_PLEASE_CHOOSE']; ?></option>"
																			<?php $Qshipper= "select * from shipper ";
																				  $shipperResult = $db->sql_fetch($Qshipper);
																				  foreach($shipperResult as $c){
																					echo" <option value='". $c[id]."' ";
																							if(isset($_POST['shipper']) && $_POST['shipper']==$c[id]){echo "selected"; }
																					echo" >". $c[name]."</option>";		
																				  }
																				?>
																		</select>
																	</td>
																</tr>
																<tr>
																	<td colspan="3" style="height:5px"></td>
																</tr>
																<tr>
																	<td colspan="3" class="tahoma11G">Sila Hantar Ke :</td>
																</tr>
																
																<tr>
																	<td colspan="3">
																		<fieldset style="border:none;" >
																			<legend class="tahoma11G">
																				<input type="radio" name="billaddress" value="billaddress"  id="billaddress" <?php if($isSemakCheckout) echo "disabled"; ?>
																					<?php if(isset($_POST['billaddress']) && $_POST['billaddress']=='billaddress'){echo "checked"; }  ?> />
																				<span><?php echo $lang['FORM_MAILING_ADDRESS']; ?></span>
																			</legend> 
																			<?php 
																				$QMailAddress = "SELECT * from address where id = '$mailing_address_id'";
																				$MailAddressResult = $db->sql_list($QMailAddress);
																			?>
																			<table id="tblBillAddress" width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd"><?php echo $lang['FORM_NAME']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G"><input type="text" name="mail_name" 
																						value="<?php echo $QUresult['name']; ?>" size="40" <?php if($isSemakCheckout) echo "disabled"; ?> ></td>
																				</tr>
																				<tr>
																					<td colspan="3" style="height:5px"></td>
																				</tr>
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd"><?php echo $lang['FORM_PHONE']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G"><input type="text" name="mail_phone" 
																						value="<?php echo $QUresult['notel']; ?>" size="40" <?php if($isSemakCheckout) echo "disabled"; ?> ></td>
																				</tr>
																				<tr>
																					<td colspan="3" style="height:5px"></td>
																				</tr>
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd" ><?php echo $lang['FORM_ADDRESS']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G" >
																					
																						<textarea style="overflow:hidden; width:260px;"
																							rows="3"  name="mail_address" id="mail_address" <?php if($isSemakCheckout) echo "disabled"; ?> ><?php echo $MailAddressResult['address']; ?></textarea>
																					</td>
																				</tr>
																				<tr>
																					<td colspan="3" style="height:5px"></td>
																				</tr>
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd"><?php echo $lang['FORM_POSKOD']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G"><input type="text" name="mail_poskod" 
																						value="<?php echo $MailAddressResult['poskod']; ?>" size="40" <?php if($isSemakCheckout) echo "disabled"; ?> ></td>
																				</tr>
																				<tr>
																					<td colspan="3" style="height:5px"></td>
																				</tr>
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd"><?php echo $lang['FORM_CITY']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G"><input type="text" name="mail_city" 
																						value="<?php echo $MailAddressResult['city']; ?>" size="40" <?php if($isSemakCheckout) echo "disabled"; ?> ></td>
																				</tr>
																				<tr>
																					<td colspan="3" style="height:5px"></td>
																				</tr>
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd"><?php echo $lang['FORM_STATE']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G">
																						<select name="mail_state"  size="1" style="width:276px;" <?php if($isSemakCheckout) echo "disabled"; ?> >
																							 <option value='' ><?php echo $lang['FORM_PLEASE_CHOOSE']; ?></option>"
																							<?php $Qstate= "select * from states  order by state asc";
																								  $stateResult = $db->sql_fetch($Qstate);
																								  
																								  foreach($stateResult as $c){
																										if($MailAddressResult['state_id'] > 0){
																											if($MailAddressResult['state_id'] ==  $c['id']){
																												echo" <option value='". $c[id]."' selected>". $c[state]."</option>";
																											}else{
																												echo" <option value='". $c[id]."'>". $c[state]."</option>";
																											}
																										}else{
																											echo" <option value='". $c[id]."'>". $c[state]."</option>";
																										}
																								  }
																								?>
																						</select>
																					</td>
																				</tr>
																				<tr>
																					<td colspan="3" style="height:5px"></td>
																				</tr>
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd"><?php echo $lang['FORM_COUNTRY']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G" >
																						<select name="mail_country"  size="1" style="width:276px;" <?php if($isSemakCheckout) echo "disabled"; ?> >
																							<?php $Qcountry= "select * from countries where country_name = 'Malaysia' order by country_name asc";
																								  $countryResult = $db->sql_fetch($Qcountry);
																								  
																								  foreach($countryResult as $c){
																										if($MailAddressResult['country_id'] > 0){
																											if($MailAddressResult['country_id'] ==  $c['id']){
																												echo" <option value='". $c[id]."' selected>". $c[country_name]."</option>";
																											}else{
																												echo" <option value='". $c[id]."'>". $c[country_name]."</option>";
																											}
																										}else if($c['country_code'] == 'MY'){
																											echo" <option value='". $c[id]."' selected>". $c[country_name]."</option>";
																										}else{
																											echo" <option value='". $c[id]."'>". $c[country_name]."</option>";
																										}
																										
																								  }
																								?>
																						</select>
																					</td>
																				</tr>
																			</table>
																		</fieldset>
																	</td>
																</tr>
																<tr>
																	<td colspan="3" style="height:5px"></td>
																</tr>
																<tr>
																	<td colspan="3">
																		<fieldset style="border:none;" >
																			<legend class="tahoma11G">
																				<input type="radio" name="shipaddress" value="shipaddress" id="shipaddress" <?php if($isSemakCheckout) echo "disabled"; ?>
																					<?php if(isset($_POST['shipaddress']) && $_POST['shipaddress']=='shipaddress'){echo "checked"; }  ?>		/>
																				<span><?php echo $lang['FORM_SHIPPING_ADDRESS']; ?></span></legend> 
																			<?php 
																				$QShipAddress = "SELECT * from address where id = '$shipping_address_id'";
																				$ShipAddressResult = $db->sql_list($QShipAddress);
																			?>
																			<table id="tblShipAddress" width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd"><?php echo $lang['FORM_NAME']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G"><input type="text" name="ship_name" 
																						value="<?php echo $ShipAddressResult['nama']; ?>" size="40"  <?php if($isSemakCheckout) echo "disabled"; ?> ></td>
																				</tr>
																				<tr>
																					<td colspan="3" style="height:5px"></td>
																				</tr>
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd"><?php echo $lang['FORM_PHONE']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G"><input type="text" name="ship_phone" 
																						value="<?php echo $ShipAddressResult['notel']; ?>" size="40"  <?php if($isSemakCheckout) echo "disabled"; ?> ></td>
																				</tr>
																				<tr>
																					<td colspan="3" style="height:5px"></td>
																				</tr>
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd"><?php echo $lang['FORM_ADDRESS']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G" >
																					
																						<textarea style="overflow:hidden; width:260px;"
																							rows="3"  name="ship_address" id="ship_address"  <?php if($isSemakCheckout) echo "disabled"; ?> ><?php echo $ShipAddressResult['address']; ?></textarea>
																					</td>
																				</tr>
																				<tr>
																					<td colspan="3" style="height:5px"></td>
																				</tr>
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd"><?php echo $lang['FORM_POSKOD']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G"><input type="text" name="ship_poskod" 
																						value="<?php echo $ShipAddressResult['poskod']; ?>" size="40"  <?php if($isSemakCheckout) echo "disabled"; ?> ></td>
																				</tr>
																				<tr>
																					<td colspan="3" style="height:5px"></td>
																				</tr>
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd"><?php echo $lang['FORM_CITY']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G"><input type="text" name="ship_city" 
																						value="<?php echo $ShipAddressResult['city']; ?>" size="40"  <?php if($isSemakCheckout) echo "disabled"; ?> ></td>
																				</tr>
																				<tr>
																					<td colspan="3" style="height:5px"></td>
																				</tr>
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd"><?php echo $lang['FORM_STATE']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G">
																						<select name="ship_state"  size="1" style="width:276px;" <?php if($isSemakCheckout) echo "disabled"; ?> >
																							<?php $Qstate2= "select * from states  order by state asc";
																								  $stateResult2 = $db->sql_fetch($Qstate2);
																								  
																								  foreach($stateResult2 as $c){
																										if($ShipAddressResult['state_id'] > 0){
																											if($ShipAddressResult['state_id'] ==  $c['id']){
																												echo" <option value='". $c[id]."' selected>". $c[state]."</option>";
																											}else{
																												echo" <option value='". $c[id]."'>". $c[state]."</option>";
																											}
																										}else{
																											echo" <option value='". $c[id]."'>". $c[state]."</option>";
																										}
																								  }
																								?>
																						</select>
																					</td>
																				</tr>
																				<tr>
																					<td colspan="3" style="height:5px"></td>
																				</tr>
																				<tr>
																					<td width="30%" class="tahoma11G cartAddrTableTd"><?php echo $lang['FORM_COUNTRY']; ?></td>
																					<td width="5%"> : </td>
																					<td class="tahoma11G" >
																						<select name="ship_country"  size="1" style="width:276px;" <?php if($isSemakCheckout) echo "disabled"; ?> >
																							<?php $Qcountry2= "select * from countries where country_name = 'Malaysia' order by country_name asc";
																								  $countryResult2 = $db->sql_fetch($Qcountry2);
																								  
																								  foreach($countryResult2 as $c){
																										if($ShipAddressResult['country_id'] > 0){
																											if($ShipAddressResult['country_id'] ==  $c['id']){
																												echo" <option value='". $c[id]."' selected>". $c[country_name]."</option>";
																											}else{
																												echo" <option value='". $c[id]."'>". $c[country_name]."</option>";
																											}
																										}else if($c['country_code'] == 'MY'){
																											echo" <option value='". $c[id]."' selected>". $c[country_name]."</option>";
																										}else{
																											echo" <option value='". $c[id]."'>". $c[country_name]."</option>";
																										}
																										
																								  }
																								?>
																						</select>
																					</td>
																				</tr>
																			</table>
																		</fieldset>
																	</td>
																</tr>
																<tr>
																	<td colspan="3" style="height:5px"></td>
																</tr>
															</table>
														</fieldset>
														<br />
														<div id="waitingCheckOut" style="display: none;">
															<img src="images/loading.gif" height="16" width="16" title="Loader" alt="Loader" />
														</div>
														<?php
														$cart = $_SESSION['cart'];
														if($cart){
														
														?>
														<table border="0" cellspacing="0" cellpadding="0">
															<?php if($isSemakCheckout){ ?>
															<tr>
																<td colspan="3" class="tahoma12CK"><input type="checkbox" name="checkboxTerm" value="1" id="checkboxTerm">Saya bersetuju dengan terma dan syarat-syarat yang disediakan. <a href="term.php" target="_blank" >Klik terma dan syarat-syarat</a>. 
																</td>
															</tr>
															<?php } ?>
															<tr>
																
																<td  class="tahoma12CK"><?php echo $lang['CONTENT_CART_CHECKOUT_INFO']; ?> </td>
																<td width="10"></td>
																<td>
																	<?php if(!$isSemakCheckout){ ?>
																	<button name="checkout" type="submit" style="border: 0; background: transparent;float:right; margin-right:170px;	cursor:pointer;">
																			<img style='cursor:pointer;' id='checkoutImg' src='img/btn_checkout.jpg' width='71' height='20' border='0'>
																	</button>
																	<?php } ?>
																	<?php if($isSemakCheckout){ ?>
																	<button name="checkoutcfm" id="checkoutcfm"  type="submit" style="border: 0; background: transparent;float:right; margin-right:170px;	cursor:pointer;">
																			<img style='cursor:pointer;' id='checkoutImgCfm' src='img/btn_checkoutconfirm.jpg' width='112' height='20' border='0'>
																	</button>
																	<button name="checkoutcfmpay" id="checkoutcfmpay"  type="submit" style="width:5px; visibility:hidden;" />		
																	<input type="hidden" id="cpayment" name="cpayment" value="" >
																	<input type="hidden" id="cOut" value="cOut" >
																	<?php } ?>
																</td>
															</tr>
														</table>	
														<?php
														}  //close if session is null
														?>
							
													</form>
													<div id="dialog" title="Pilihan Pembayaran">
														<p id="validateTips">Sila pilih cara bayaran.</p>

														<form action="" method="post" >
														<fieldset>
															<label for="name">Pilihan Bayaran</label>
															<select id="selectpayment" name="selectpayment" style="width:220px;">
																<option value="01">Pembayaran Secara Bank Online</option>
																<option value="02">Pembayaran Secara Credit Card</option>
															</select>
														</fieldset>
														</form>
													</div>
													<table border="0" cellspacing="0" cellpadding="0">
														<tr>
															<td  class="tahoma12CK"><?php echo $lang['CONTENT_CART_NBEPAY_INFO']; ?> </td>
															<td width="10"></td>
															<td><img  src='img/spec_logo_nbepay.jpg' width='97' height='30' border='0'></td>
														</tr>
													</table>
													
                                                      <br/>													  
													  <span class="tahoma12CK"><?php echo $lang['CONTENT_CART_PRODUCT_INFO']; ?>
														<a href="product.php" style="color:#990000; font-weight:bold;"><?php echo $lang['MENU_OUR_PRODUCTS']; ?></a></span>
                                                    </td>
                                                    <td width="10">&nbsp;</td>
                                                  </tr>
                                                  <tr> 
												  
                                                    <td width="10" height="10"></td>
                                                    <td height="10"></td>
                                                    <td width="10" height="10"></td>
                                                  </tr>
                                                </table></td>
												
                                            </tr>
                                          </table></td>
                                      </tr>
                                    </table></td>
                                </tr>
                              </table>